package com.exchangeek.server.entity.bean;

import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;

import javax.persistence.Entity;

/**
 * Created with IntelliJ IDEA.
 * Project Name: Exchangeek_Server
 * Date Created: 2013/09/15 下午5:20
 *
 * @author Wings
 */

@Entity
@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserSkill {
    private SkillLevel level;
    private String skillName;

    public UserSkill() {
    }

    public UserSkill(int i, String skillName) {

    }

    @Override
    //重写level, 将level放在前面便于按等级排序。
    public String toString() {
        return level + skillName;
    }

    public SkillLevel getLevel() {
        return level;
    }

    public UserSkill setLevel(SkillLevel level) {
        this.level = level;
        return this;
    }

    public String getSkillName() {
        return skillName;
    }

    public UserSkill setSkillName(String skillName) {
        this.skillName = skillName;
        return this;
    }

    public enum SkillLevel {
        //额。。。其实我也是才发现Java竟然允许用中文做变量名。。。。
        一无所知(0, "一无所知"),
        差强人意(1, "差强人意"),
        得心应手(2, "得心应手"),
        游刃有余(3, "游刃有余"),
        炉火纯青(4, "炉火纯青");
        private int _value;
        private String _name;

        private SkillLevel(int value, String name) {
            _value = value;
            _name = name;
        }

        public int value() {
            return _value;
        }

        public String getName() {
            return _name;
        }
    }
}
